﻿using Deployment.Data.UI.Controls.Step;
using Deployment.Data.UI.Dialogs;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;

namespace Deployment.Data.UI.Dialogs.Step
{
    public class AddStepDialog : AbstractDialog
    {
        public static readonly DependencyProperty DeploymentProperty =
            DependencyProperty.Register("Deployment",
                typeof(Data.Deploy.DeploymentFile),
                typeof(AddStepDialog));

        public static readonly DependencyProperty EnvironmentsProperty =
            DependencyProperty.Register("Environments",
                typeof(Data.Environment.EnvironmentsFile),
                typeof(AddStepDialog));

        

        public Data.Deploy.DeploymentFile Deployment
        {
            get { return (Data.Deploy.DeploymentFile)GetValue(DeploymentProperty); }
            set 
            { 
                SetValueDp(DeploymentProperty, value);
                (ContentControl as StepEditorControl).Deployment = Deployment;
            }
        }

        public Data.Environment.EnvironmentsFile Environments
        {
            get { return (Data.Environment.EnvironmentsFile)GetValue(EnvironmentsProperty); }
            set 
            { 
                SetValueDp(EnvironmentsProperty, value);
                (ContentControl as StepEditorControl).Environments = value;
            }
        }

        public AddStepDialog() :
            base("Add Deployment Step") 
        {
            
            StepEditorControl control = new StepEditorControl();
            //control.DataContext = this.DataContext;
            this.ContentControl = control;
        }

        public Data.Deploy.Steps.Step NewStep
        {
            get { return this.ContentControl.DataContext as Data.Deploy.Steps.Step; }
        }

        protected override bool performOkAction()
        {
            return true;
        }
    }
}
